load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "autoid",
    srcs = [
        "autoid.go",
        "autoid_service.go",
        "errors.go",
        "memid.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/meta/autoid",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/errno",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/metrics",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/types",
        "//pkg/util/dbterror",
        "//pkg/util/execdetails",
        "//pkg/util/logutil",
        "//pkg/util/tracing",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/autoid",
        "@com_github_tikv_client_go_v2//txnkv/txnsnapshot",
        "@com_github_tikv_client_go_v2//util",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "autoid_test",
    timeout = "short",
    srcs = [
        "autoid_test.go",
        "bench_test.go",
        "main_test.go",
        "memid_test.go",
        "seq_autoid_test.go",
    ],
    flaky = True,
    shard_count = 10,
    deps = [
        ":autoid",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/store/mockstore",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
